﻿using System;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Framework.UI
{
    public class ExSlider : Slider
    {
        public enum EnumCallbackType
        {
            /// <summary>数值改变开始</summary>
            ValueChangeBegin,
            /// <summary>数值改变</summary>
            ValueChange,
            /// <summary>数值改变结束</summary>
            ValueChangeEnd,
        }

        public Action<float> OnValueChangeBegin { get; set; }
        public Action<float> OnValueChangeEnd { get; set; }

        public override void OnPointerDown(PointerEventData eventData)
        {
            if (OnValueChangeBegin != null)
            {
                OnValueChangeBegin?.Invoke(value);
                base.OnPointerDown(eventData);
            }
        }

        public override void OnPointerUp(PointerEventData eventData)
        {
            if (OnValueChangeEnd != null)
            {
                OnValueChangeEnd?.Invoke(value);
                base.OnPointerUp(eventData);
            }
        }
    }
}